= render :partial => "breadcrumb", :locals => { :action => '列表' }
- content_for :sidebar do
  = render :partial => "sidebar"

= link_to '新增', new_admin_product_path, :class => 'btn btn-mini btn-success pull-right'
%br/

= search_form_for @q, url: admin_products_path, method: :get do |f|
  = f.condition_fields do |c|
    .field
      = render('condition_fields', f: c)
  = link_to_add_fields "添加条件", f, :condition
  = f.submit "Search", :class => 'btn btn-mini btn-success'




- if @products.size == 0 
  .alert no records
- else 
  %span{:class => 'label label-info'} 商品列表
  %table.table.table-bordered.table-striped
    %thead
      %tr
        %th= sort_link @q, :id, "ID"
        %th= sort_link @q, :name, '商品名称'
        %th= sort_link @q, :price, '商品价格'
        %th{:style => 'width:160px;'}操作
    %tbody
      - @products.each do |p|
        %tr 
          %td= p.id
          %td= p.name
          %td= p.price
          %td
            %ul.inline
              %li= link_to '编辑', edit_admin_product_path(p), {:class => 'btn btn-mini'}
              %li= link_to '查看', admin_product_path(p), {:class => 'btn btn-mini'}
              %li= button_to '删除', admin_product_path(p), :class => 'btn btn-danger btn-mini', :method => :delete, :data => {:confirm => 'really?'}


